package net.esj.basic.plugins.spring.factory.xml.parser;

import org.springframework.beans.factory.parsing.BeanComponentDefinition;
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser;
import org.springframework.beans.factory.xml.ParserContext;
import org.w3c.dom.Element;

@Deprecated
public class SourceLocaleBeanDefinitionParser extends
		AbstractSingleBeanDefinitionParser {

	@Override
	protected void doParse(Element element, ParserContext parserContext,
			BeanDefinitionBuilder builder) {
		if (!parserContext.getRegistry().containsBeanDefinition(getBeanClassName(element))) {
			String dataSource = element.getAttribute("source");
			builder.addPropertyReference("source", dataSource);
			parserContext.registerBeanComponent(
					new BeanComponentDefinition(builder.getBeanDefinition(),getBeanClassName(element)));
		}
	}

	@Override
	protected String getBeanClassName(Element element) {
		String id = element.getAttribute("class");
		return id;
	}

	
}
